const EventEmitter = require('events');

class MyEmitter extends EventEmitter { };

const myEmitter = new MyEmitter();

function handler () {
  console.log('点击了我');
}

myEmitter.on('myclick', handler)
myEmitter.on('myclick', () => {
  console.log('再次点击');
})

// 事件解绑
myEmitter.off('myclick', handler)

console.log(myEmitter.listeners('myclick'));

myEmitter.emit('myclick');